import "reflect-metadata";

interface ControllerOptions {
  prefix?: string;
}
export function Controller(): ClassDecorator;
export function Controller(prefix: string): ClassDecorator;
export function Controller(options: ControllerOptions): ClassDecorator;
export function Controller(prefixOrOptions?: string | ControllerOptions): ClassDecorator {
  let options: ControllerOptions = {};

  if (typeof prefixOrOptions === "string") {
    options.prefix = prefixOrOptions;
  } else if (typeof prefixOrOptions === "object") {
    options = prefixOrOptions;
  } else {
    options.prefix = "";
  }
  return function (target: any) {
    Reflect.defineMetadata("prefix", options.prefix, target);
  };
}
